package com.unitechs.trap.write.webapi.service.impl;


import com.unitechs.trap.common.pojo.trap.entity.TrapVarBind;
import com.unitechs.trap.excel.service.ITrapVarBindExcelService;
import com.unitechs.trap.write.service.ITrapVarBindService;
import com.unitechs.trap.write.webapi.mapper.TrapVarBindMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@DubboService
@Slf4j
@Service

public class TrapVarBindServiceImpl implements ITrapVarBindService {

    @Autowired
    private TrapVarBindMapper trapVarBindMapper;
    @DubboReference(timeout = 1*1024*1024*1024)
    private ITrapVarBindExcelService trapVarBindExcelService;

    @Override
    public int insertTrapVarBinds() {
        List<TrapVarBind> trapVarBinds=trapVarBindExcelService.listTrapVarBind();
        log.info("trapVarBinds{}",trapVarBinds);
        if (trapVarBinds==null||trapVarBinds.isEmpty()){
            return 0;
        }
        int i = trapVarBindMapper.insertTrapVarBinds(trapVarBinds);
        return i;
    }
}
